package com.itheima.cn;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @description:
 * @author: yuanfei
 * @date: 2020/8/4 14:09
 */
public class DateUtils {

    private static final ThreadLocal<DateFormat> df = new ThreadLocal<DateFormat>(){
        @Override
        protected DateFormat initialValue() {
            return new SimpleDateFormat("yyyy-MM-dd");
        }
    };


    /**
     * 时间格式化
     * @param date
     * @return
     */
    public  static  String dateFormart(Date date){

        return df.get().format(date);
    }


}
